package com.xu.blog_after_end.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/admin/**")  // 拦截路径
                .excludePathPatterns("/admin/login","/admin/login.html","/admin");  // 放行路径
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
